<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Sets the class name used with SplFileInfo::openFile</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="splfileinfo.openfile.html">SplFileInfo::openFile</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="splfileinfo.setinfoclass.html">SplFileInfo::setInfoClass</a></div>
 <div class="up"><a href="class.splfileinfo.html">SplFileInfo</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="splfileinfo.setfileclass" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">SplFileInfo::setFileClass</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.1.2)</p><p class="refpurpose"><span class="refname">SplFileInfo::setFileClass</span> &mdash; <span class="dc-title">Sets the class name used with <span class="methodname"><a href="splfileinfo.openfile.html" class="methodname">SplFileInfo::openFile()</a></span></span></p>

 </div>

 <div class="refsect1 description" id="refsect1-splfileinfo.setfileclass-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>SplFileInfo::setFileClass</strong></span>
    ([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$class_name</code></span>
  ] )</div>

  <p class="para rdfs-comment">
   Set the class name which SplFileInfo will use to open files with when openFile() is called.
   The class name passed to this method must be derived from SplFileObject.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-splfileinfo.setfileclass-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">class_name</code></em></dt>

     <dd>

      <p class="para">
       The class name to use when openFile() is called. 
      </p>
     </dd>

    
   </dl>

  </p>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-splfileinfo.setfileclass-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   没有返回值。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-splfileinfo.setfileclass-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-3849">
    <p><strong>Example #1 <span class="function"><strong>SplFileInfo::setFileClass()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;Create&nbsp;a&nbsp;class&nbsp;extending&nbsp;SplFileObject<br /></span><span style="color: #007700">class&nbsp;</span><span style="color: #0000BB">MyFoo&nbsp;</span><span style="color: #007700">extends&nbsp;</span><span style="color: #0000BB">SplFileObject&nbsp;</span><span style="color: #007700">{}<br /><br /></span><span style="color: #0000BB">$info&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">SplFileInfo</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">//&nbsp;Set&nbsp;the&nbsp;class&nbsp;to&nbsp;use<br /></span><span style="color: #0000BB">$info</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setFileClass</span><span style="color: #007700">(</span><span style="color: #DD0000">'MyFoo'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$info</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">openFile</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
object(MyFoo)#2 (0) { } 
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-splfileinfo.setfileclass-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="methodname"><a href="splfileinfo.openfile.html" class="methodname" rel="rdfs-seeAlso">SplFileInfo::openFile()</a> - Gets an SplFileObject object for the file</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="splfileinfo.openfile.html">SplFileInfo::openFile</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="splfileinfo.setinfoclass.html">SplFileInfo::setInfoClass</a></div>
 <div class="up"><a href="class.splfileinfo.html">SplFileInfo</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
